from django.db import models
from apps.common.base.models import BaseModel


class Lessee(BaseModel):
    status = (
        (0, "关闭"),
        (1, "正常"),
    )
    user = models.ForeignKey('user.UserModel', related_name='user_lessee', verbose_name='管理员',
                             on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)
    name = models.CharField("名称", max_length=200, blank=True, null=True, default='')
    addr = models.CharField("地址", max_length=200, blank=True, null=True, default='')
    contacts = models.CharField("联系人", max_length=200, blank=True, default='')
    phone = models.CharField("电话", max_length=200, blank=True, default='')
    intro = models.CharField("介绍", max_length=200, blank=True, default='')
    status = models.IntegerField("状态", choices=status, default=1)
    isInviteReg = models.BooleanField("是否需要邀请注册", default=0)
    serviceChargeRate = models.DecimalField("提现手续费率", max_digits=10, decimal_places=4, default=0)
    serviceCharge_min = models.DecimalField("最小提现金额", max_digits=10, decimal_places=2, default=10)
    serviceCharge_max = models.DecimalField("最大提现金额", max_digits=10, decimal_places=2, default=10000)
    serviceChargeNum = models.IntegerField("每日提现次数", default=1)
    uploadFileCHN = models.CharField("图片存储渠道", max_length=200, blank=True, default='')
    validateCodeCHN = models.CharField("验证码渠道", max_length=200, blank=True, default='')
    goldPrice = models.DecimalField("金价", max_digits=10, decimal_places=2, default=0)

    historyIncomes = models.DecimalField("历史累计资产", max_digits=10, decimal_places=2, default=0.00)
    incomes = models.DecimalField("当前积分", max_digits=10, decimal_places=2, default=0.00)

    # avcertificateatar = models.ForeignKey('system.File', related_name='certificate_lessee', verbose_name='营业执照',
    #                                       on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)
    realname = models.CharField("法人姓名", max_length=200, blank=True)
    bankName = models.CharField("银行名字", max_length=200, blank=True)
    bankAccount = models.CharField("银行账号", max_length=200, blank=True)

    class Meta:
        verbose_name = 'Lessee'
        verbose_name_plural = verbose_name
